import { getPackageList } from '../list/api'

/**
 * @Author: Wang chunsheng  email:2192138785@qq.com
 * @Date:   2024-02-07 21:48:04
 * @Last Modified by:   Wang chunsheng  email:2192138785@qq.com
 * @Last Modified time: 2024-02-15 20:03:47
 */
export const form = {
  package_id: {
    label: '选择套餐',
    // 只需要在这里指定为 tree-select 即可
    type: 'tree-select',
    // 属性参考: https://vue-treeselect.js.org/
    attrs: {
      multiple: false,
      clearable: true
    },
    options: async data => {
      const res = await getPackageList()
      const arr = [{
        id: 0,
        label: '选择套餐'
      }]
      return arr.concat(res.data)
    }
  },
  'time_name': {
    'type': 'input',
    'label': '时长名称'
  },
  'time_description': {
    'type': 'input',
    'label': '时长描述'
  },
  'time_price': {
    'type': 'input',
    'label': '时长价格',
    attrs: {
      type: 'number',
      step: 0.01
    }
  },
  'time_length': {
    'type': 'number',
    'label': '时长/月'
  }
}

export const order = ['package_id', 'time_name', 'time_description', 'time_price']

export const tableColumns = [{
  'label': '套餐',
  'prop': 'package.package_name'
}, {
  'label': '时长名称',
  'prop': 'time_name'
}, {
  'label': '时长描述',
  'prop': 'time_description'
}, {
  'label': '时长价格',
  'prop': 'time_price'
}, {
  'label': '时长/月',
  'prop': 'time_length'
}, {
  'label': '操作',
  'prop': 'action',
  'slot': 'action'
}]

export const filterInfo = {
  fieldList: {
    'label': '更新时间',
    'type': 'input',
    'value': 'DiandiSubscriptionPackageTime[update_time]'
  }

}

export const path = {
  index: 'diandi-subscription-package-time-index',
  update: 'diandi-subscription-package-time-update',
  create: 'diandi-subscription-package-time-create',
  api: '/diandi_subscription/package/time'
}

export const rowKey = 'time_id'
